using Vin.Extension.Win32.Command.Node;

namespace Vin.Extension.Win32.Command.Workflow;

public interface IWorkflowContext
{
    /// <summary>
    /// 工作流数据
    /// </summary>
    public WorkflowData WorkflowData { get; internal set; }

    /// <summary>
    /// 节点上下文
    /// </summary>
    public Dictionary<string, INodeContext>? NodeContextDict { get; internal set; }

    #region INodeContext

    internal void AddNodeContext(string nodeId, INodeContext nodeContext)
    {
        NodeContextDict ??= new();
        NodeContextDict.Add(nodeId, nodeContext);
    }

    INodeContext? NodeContext(string nodeId) => NodeContextDict != null && NodeContextDict.ContainsKey(nodeId)
        ? NodeContextDict[nodeId]
        : null;

    #endregion
}